package com.fzy.modules.goods.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.fzy.modules.goods.entity.GoodsMore;
import com.fzy.modules.goods.service.GoodsService;

@Controller
@RequestMapping("/page")
public class PageController {
	@Autowired
    GoodsService goodsService;
	/**
	 * 跳转页面
	 * @param pageName
	 * @param _ 时间
	 * @return
	 */
    @RequestMapping(value = "/{pageName}")
    public String GoodsDetails(@PathVariable String pageName,String _){
    	return pageName;
    }
    //分享控制层
    @RequestMapping(value = "/shareGoodsMore/{goodsId}")
    public String shareGoodsMore(@PathVariable String goodsId,Model model){
    	GoodsMore goodsMore= new GoodsMore();
    	goodsMore.setId(goodsId);
    	model.addAttribute("goodsInfo",goodsService.findGoodsMore(goodsMore));
    	return "sharehtml";
    }
    /**
     * 图片请求显示
     * @return
     */
   /* @RequestMapping(value = "/pics/{goodsName}")
    public String imageShow(@PathVariable String goodsName){
    	System.out.println(goodsName);
    	// TODO 图片读取的问题没有解决
    	return "";
    }*/
}
